import { TOKEN_TIME, TOKEN_TIME_VALUE } from './constant'

// 登录时设置时间
export const setTokenTime = () => {
  localStorage.setItem(TOKEN_TIME, Date.now())
}

// 获取
export const getTokeTime = () => {
  return localStorage.getItem(TOKEN_TIME)
}

// 判断token是否失效
export const diffTokenTime = () => {
  const currentTime = Date.now()
  const tokenTime = getTokeTime()
  return currentTime - tokenTime > TOKEN_TIME_VALUE
}

// 获取验证码
export const updateVerifyCode = () => {
  return '/api/fmms/systemController/getVerifyCodeImage?time=' + Date.now()
}
